package cn.zzuisa.news.util;

import cn.zzuisa.news.VO.ResultVO;
import cn.zzuisa.news.enums.CommonEnums;
import cn.zzuisa.news.enums.FilterEnums;

/**
 * @ClassName: ResultVOUtil.java
 * @Description: TODO
 * @author zzuisa
 * @version V1.0
 * @Date 2018年9月4日 下午4:45:12
 */
public class ResultVOUtil {
	public static ResultVO success(Object object) {
		ResultVO resultVO = new ResultVO();
		resultVO.setData(object);
		resultVO.setCode(0);
		resultVO.setMsg("🎉操作成功🎉");
		return resultVO;
	}

	public static ResultVO success() {
		return success(null);
	}

	public static ResultVO failed(Integer code, String msg) {
		ResultVO resultVO = new ResultVO();
		resultVO.setCode(code);
		resultVO.setMsg(msg);
		return resultVO;
	}
	public static ResultVO failed(CommonEnums enum1) {
		ResultVO resultVO = new ResultVO();
		resultVO.setCode(enum1.getCode());
		resultVO.setMsg(enum1.getMessage());
		return resultVO;
	}
	public static ResultVO failed(FilterEnums enum1) {
		ResultVO resultVO = new ResultVO();
		resultVO.setCode(enum1.getCode());
		resultVO.setMsg(enum1.getMessage());
		return resultVO;
	}
}
